﻿@model WebApplication1.ViewModels.CustomerFormViewModel
@{
    ViewBag.Title = "CustomerForm";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@Model.OperationName</h2>

@using (Html.BeginForm("Save", "Customer"))
{
    @Html.ValidationSummary(true, "smth wrong:")
    <div class="form-group">
        @Html.LabelFor(m=>m.FirstName)
        @Html.TextBoxFor(m => m.FirstName, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.FirstName)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.LastName)
        @Html.TextBoxFor(m => m.LastName, new { @class = "form-control" })
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.DateOfBirth)
        @Html.EditorFor(m => m.DateOfBirth, new { htmlAttributes = new { @class = "form-control", @Value = "yyyy-MM-dd" } })
        @Html.ValidationMessageFor(m => m.DateOfBirth)
      </div>
    <div class="form-group">
            @Html.LabelFor(m => m.MembershipType)
            @Html.DropDownListFor(m => m.MembershipTypeId,
            new SelectList(Model.MembershipTypes, "Id", "Name"), "Select smth", new { @class = "form-control" })
            @Html.ValidationMessageFor(m => m.MembershipTypeId)
        </div>
    <div class="checkbox">
            <label>
                @Html.CheckBoxFor(m => m.IsSubscribed) Subscribe to news?
                @Html.AntiForgeryToken()
            </label>
        </div>
        @Html.HiddenFor(m=>m.Id)
        <button type="submit" class="btn btn-primary">Save</button>
        }
        
        @section scripts
        {
            @Scripts.Render("~/bundles/jqueryval")
        }